﻿using EventBus.Models;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;

namespace EventBus.Controllers
{
    public class HomeController : Controller
    {
        private readonly ILogger<HomeController> _logger;

        public MyService myService { get; set; }

        public IStudentService studentService { get; set; }
       
        public HomeController(ILogger<HomeController> logger)
        {
            _logger = logger;
        }

        public IActionResult Index()
        {
           
            //myService.ChangeStockCountAsync(Guid.NewGuid(), 100).GetAwaiter();
            //Console.WriteLine("任务执行完毕");
            return View();
        }


        public async Task<IActionResult> Test()
        {
           await studentService.InsertAsync("张三", new Random().Next());

            return Ok("Ok");
        }

        

        public IActionResult Privacy()
        {
            return View();
        }

        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }
    }
}